package com.ywk.base.designPattern.observer.myObserver;

/**
 * 具体观察者
 *
 * @Author zbh
 * @Date 2023/4/3
 */
public class ConcreteObserver implements Observer{
    private String name;

    private Subject subject;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ConcreteObserver(String name,Subject subject){
        this.name= name;
        this.subject = subject;
        this.subject.registerObserver(this);
    }
    @Override
    public void update(){
        // 具体的实现
        System.out.println(name+"前往取奶");
    }
}
